public class Singletontest03 {
    static {
        System.out.println("懒汉式-线程不安全!");
    }

    public static void main(String[] args) throws Exception{
        Singletion03 instance =  Singletion03.getInstance();
        Singletion03 instance2 = Singletion03.getInstance();
        System.out.println(instance == instance2);
        System.out.println(instance.hashCode());
        System.out.println(instance2.hashCode());
    }
}
class Singletion03{
    private Singletion03(){

    }
    private static Singletion03 instance;
    public static Singletion03 getInstance(){
        if (instance==null){
            instance=new Singletion03();
        }
        return instance;
    }
}
